<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>软件测试技术案例</title> 
<base href="<%=basePath%>"/>
<link rel="stylesheet" type="text/css" href="static/css/sm-default.css" />
<link rel="stylesheet" type="text/css" href="static/css/styles.css" />
<meta name="description" content="软件测试技术案例" />
<meta name="keywords" content="software testing, SpringMVC,Testing" />

<script type="text/javascript" src="static/js/jquery.min.js"></script>
<script type="text/javascript" src="static/js/json2.js"></script>
<script type="text/javascript"> 
function check(){  
	var id = 5;
	//数据的Json转换
	var jsonanswer = JSON.stringify(id); 
	alert(jsonanswer);
	$.ajax({
		type : 'POST',
		contentType : 'application/json',
		url : '<%=basePath%>test/myjson',
		data : jsonanswer,
		dataType : 'json',
		success : function(data){ 
			alert(data.name); 
		}
		
	});
}   
</script>
</head>
<body>
<button id="btn" onclick="check()">提交</button>
					
</body>
</html>